<!-- 分页烂组件-->
<!-- 参数 应使用v-model 进行双向绑定
value:{
		total: 0,
		pageSize: 20,
		pageNum: 1,
	}
-->

<!-- 事件
  change 通知分页发生变化 使用者一般是在这个时候进行联网请求
-->

<template>
	<div style="text-align:right">
		<!--分页条total, sizes, prev, pager, next, jumper-->
		<el-pagination background layout="total,sizes,prev, pager, next,jumper" :current-page="value.pageNum"
			:page-size="value.pageSize" :total="value.total"
			:page-sizes="pageSizeArr && pageSizeArr.length > 0 ?pageSizeArr:[5,10,20,50]" @size-change="changeSize"
			@current-change="changepageNum"></el-pagination>
	</div>
</template>

<script>
	export default {
		name: "mainview",
		props: {
			'pageSizeArr': Array,
		},
		components: {},
		data() {
			return {
				value:{
					pageNum:0,
					pageSize:20,
					total:100,
				}
			};
		},
		created() {},
		methods: {
			// 当前页修改
			changepageNum(val) {
				this.$emit('change')
			},
			// 页码修改
			changeSize(val) {
				this.$emit('change')
			},
			setPage(p)
			{
				this.value.pageNum = p;
			},
			//获取页码信息
			getPageData()
			{
				return {
					pageNum:this.value.pageNum,
					pageSize:this.value.pageSize,
					total:this.value.total,
				}
			}
		}
	};
</script>

<style>
</style>
